
class MBasicSprite extends MBasice{
    /**角度转弧度*/
    angleToRadian(angle){
		return angle*Math.PI/180;
	}
    /**圆形文本框（类型时钟上的数字） */
    drawCircleText(labels,radius=50,scale=1,initAng=-45){
        let len=labels.length;
        let texts=[];
        for(let i=0;i<len;i++){
            let txt=new MLabel({label:labels[i]});
            this.addChild(txt);
            txt.scale=scale;
            texts.push(txt);
        }
        this.layoutCircle(texts,radius,initAng);
        return texts;
    }
    /**画同心圆concnetric,colors颜色从内到外的顺序,radous2大于0时画同心方块*/
    drawConcCircle(colors,radous=80,radous2=0){
        let len=colors.length;
        let r=radous/len;
        let r2=radous2/len;
        let circles=[];
        for(let i=len;i>0;i--){
            let circle=new MShape();
            let c=colors[i-1];
            if(radous2>0)   circle.f(c).drawRect(-r*i,-r2*i,r*i*2,r2*i*2);
            else            circle.dc(r*i,c);
            this.addChild(circle);
            circles.push(circle);
        }
        return circles;
    }
    /**画背包格子*/
    drawBagBox({w=60,h=60,c1='#660000',c2='#FF4D4D',c3='#D20000',s1=2,s2=4,r=8}){
        let [cs,whs]=[[c1,c2,c3],[[w,h],[w-s1,h-s1],[w-s1-s2,h-s1-s2]]]
        for(let i=0;i<3;i++){
            let node=new MShape();
            let c=cs[i];
            let [w1,h1]=[whs[i][0],whs[i][1]];
            if(i==0)node.setLineSizeAndColor(s1,c1)
            node.f(c).drawRoundRect(-w1/2,-h1/2,w1,h1,r);
            this.addChild(node);
        }
    }
    drawBagCircle({r=30,c1='#660000',c2='#FF4D4D',c3='#D20000',s1=2,s2=4}){
        let [cs,rs]=[[c1,c2,c3],[r,r-s1,r-s1-s2]]
        for(let i=0;i<3;i++){
            let node=new MShape();
            let [c,r]=[cs[i],rs[i]];
            if(i==0)node.setLineSizeAndColor(s1,c1)
            node.dc(r,c);
            this.addChild(node);
        }
    }
    /**基础排版*/
    layoutBasic(array,xNum=1,xDis=0,yDis=0,x=0,y=0,sign=1)
	{
		for(let i=0;i<array.length;i++){
			let display=array[i];
			display.x=x+parseInt(i%xNum)*(display.width+xDis)*sign;
			display.y=y+parseInt(i/xNum)*(display.height+yDis)*sign;
		}
	}
    /**圆环布局*/
    layoutCircle(items,radius=50,initAng=0){
        let len=items.length;
        let [angle,a]=[initAng,Math.PI*2/len];
        for(let i=0;i<len;i++){
            let item=items[i];
            item.x=Math.cos(angle)*radius; 
            item.y=Math.sin(angle)*radius;
            angle+=a;
        }
    }
    /**矩形布局（布局在四边上）*/
    layoutRect(items,radius=100){
        let len=items.length;
        let num=Math.floor(len/4);
        let iw=items[0].width;
        let wid=radius/(num+1)-iw;
        let xy=wid+iw;
        //console.log(wid,num,wid*(num+2))
        for(let i=0;i<4;i++){
            let [s,e]=[num*i,num*(i+1)];
            let its=items.slice(s,e);
            if(i==0)        this.layoutBasic(its,num,wid,wid,xy,0);
            else if(i==1)   this.layoutBasic(its,1,wid,wid,radius,xy);
            else if(i==2)   this.layoutBasic(its,num,wid,wid,xy,radius);
            else if(i==3)   this.layoutBasic(its,1,wid,wid,0,xy);
        }
    }
     /**画爱心*/
     drawLoveSar(r=10,c='red') {
        let node=new MShape();
        node.beginFill(c);
        let ctx = node.graphics;
        for (var t = 0; t < Math.PI * 2; t += 0.01) {
            // 计算爱心的坐标
            var x = r * 0.1 * (16 * Math.pow(Math.sin(t), 3));
            var y = r * 0.1 * (13 * Math.cos(t) - 5 * Math.cos(2 * t) - 2 * Math.cos(3 * t) - Math.cos(4 * t));
            // 如果是第一个点，就移动到该点
            if (t == 0) {
                ctx.moveTo(x, y);
            } else {
                // 否则，就画一条线到该点
                ctx.lineTo(x, y);
            }
        }
        node.rotation=180;
        this.addChild(node);
        return node;
    }
}
class MClock extends MBasicSprite{
    constructor(isPlay=1){
        super();
        this.drawClock(isPlay);
    }
    /**画时钟*/
    drawClock(isPlay=1){
        this.addChild(new MShape().dcLine(100))
        this.drawCircleText([1,2,3,4,5,6,7,8,9,10,11,12],80);
		let arr=[];
		for(let i=0;i<60;i++)arr.push(new MSprite().dc(1,'white'));
        this.layoutCircle(arr,95);
		for(let i=0;i<arr.length;i++){
			let t=arr[i];//t.y-=5;
            this.addChild(t);
			if(i%5==0)t.color='black';
		}
        let wids=[100,65,50];
        let heis=[1,2,3];
        let colors=['red','black','black'];
        let lines=[];
        for(let i=0;i<3;i++){
            let [w,h,c]=[wids[i],heis[i],colors[i]];
            let line=new MShape();
            line.beginFill(c).drawRect(0,-h/2,w,h);
            lines.push(line);
            this.addChild(line);
        }
        this.lines=lines;
        this.addChild(new MSprite().dc(4,'black'));
        function playTime(){
            let date=new Date();
			let s=date.getSeconds()/60*360;
			let m=date.getMinutes()/60*360+s/360*6;
			let h=date.getHours()/12*360+m/360*30;
			s=s||360;
            let as=[s,m,h];
			for(let i=0;i<3;i++)lines[i].rotation=as[i]-90;
            if(isPlay)setTimeout(playTime,1000);
        }
        playTime();
    }
}
class MKeyboard extends MBasicSprite{
    constructor(width,stageHeight,color){
        super();
        this.width=width;
        this.stageHeight=stageHeight;
        this.color=color;
        this.initKeyboard();
    }
    initKeyboard(){
        this.isBig=false;
        this.letterBtns=[];
        let bgColor='#556655';
        if(this.color&&this.color.bgColor)bgColor=this.color.bgColor;

        let datas=['qwertyuiop','asdfghjkl','zxcvbnm'];
        let wid=this.width/11;
        let gap=wid/11;
        let [x,y]=[gap,5];

        let bg=new MSprite();
        bg.drr(this.width,(wid+gap*2)*4,5,bgColor);
        bg.y=-2;
        this.addChild(bg);

        for(let i=0;i<3;i++){
            let das=datas[i].split('');
            let btns=[];
            das.forEach((n)=>{
                let btn = this.createButton({label:n,width:wid,height:wid});
                btn.key=n;
                btn.on('click',this.onClick.bind(this));
                btns.push(btn);
                this.letterBtns.push(btn);
                this.addChild(btn);
            })
            this.layoutBasic(btns,btns.length,gap,gap,x,y);
            y+=wid+gap;
            if(i==0)x+=wid/2+gap;
            else    x=wid*2-gap*3;
        }
        let names=['↑','←'];
        let btns=[];
        let len=names.length;
        for(let i=0;i<len;i++){
            let n=names[i];
            let btn = this.createButton({label:n,width:wid+wid/2,height:wid});
            btn.key=n;
            btn.on('click',this.onClick.bind(this));
            btns.push(btn);
            this.addChild(btn);
        }
        x=gap;
        y-=wid+gap;
        this.layoutBasic(btns,btns.length,this.width-wid*3.2,gap,x,y);

        names=['123',',','space','.','↵'];
        btns.length=0;
        len=names.length;
        y+=wid+gap;
        x=gap*3;
        for(let i=0;i<len;i++){
            let n=names[i];
            let w=(i!=2)?wid+wid/2:wid*4;
            let btn = this.createButton({label:n,width:w,height:wid});
            btn.key=n;
            btn.on('click',this.onClick.bind(this));
            this.addChild(btn);
            btn.y=y;
            btn.x=x;
            x=btn.x+btn.width+gap;
        }

        bg=new MSprite();
        bg.drr(this.width,(wid+gap*2)*4,5,bgColor);
        bg.y=-2;
        this.addChild(bg);
        names=['1','2','3','←','4','5','6',',','7','8','9','.','↺','0','space','↵'];
        btns.length=0;
        len=names.length;
        for(let i=0;i<len;i++){
            let n=names[i];
            let btn = this.createButton({label:n,width:wid*2.6,height:wid});
            btn.key=n;
            btn.on('click',this.onClick.bind(this));
            btns.push(btn);
            bg.addChild(btn);
        }
        x=gap*2;
        y=gap*2;
        this.layoutBasic(btns,4,gap,gap,x,y);
        this.numKey=bg;
        this.numKey.visible=false;
        this.height=bg.height;
        this.y=this.stageHeight-this.height;
    }

    createButton(data){
        let btn=new MButton(data);
        let c=this.color;
        if(c){
            btn.setSkinColors(c.c1,c.c2,c.c3);
            if(c.fc) btn.text.color=c.fc;
        }
        return btn;
    }
    onClick(e){
        let target=e.currentTarget;
        let key=target.key;
        //console.log(key);
        if(key=='↑'){
            this.isBig=!this.isBig;
            target.text.text=this.isBig?key+':':key;
            this.letterBtns.forEach(b=>{
                let k=b.key;
                b.key=this.isBig?k.toLocaleUpperCase():k.toLocaleLowerCase();
                b.text.text=b.key;
            })
            return;
        }else if(key=='123'){
            this.numKey.visible=true;
            return;
        }else if(key=='↺'){
            this.numKey.visible=false;
            return;
        }
        if(this.callBack){
            this.callBack(key);
        }
        this.setValue(key);
    }
    setInput(input){
        this.input=input;
        this.input.setLightFocus();
        //this.input.value='|';
    }
    subStr(value){
        return value.substring(0,value.length-1);
    }
    setValue(key){
        if(this.input){
            let value=this.input.value;
            value=this.input.subStrRemove(value);
            switch(key){
                case 'space':   value+=' ';                         break;
                case '↵':       value+='\n';                        break;
                case '←':       value=this.subStr(value);           break;
                default:        value+=key;                         break;
            }
            this.input.value=value//+'|'
        }
    }
}
class MCar extends MBasicSprite{
    constructor(color='#FD8E08',carLen=100,carWid=44,midColor='white'){
        super();
        this.drawCar(color,carLen,carWid,midColor);
    }
    drawCar(color,carLen,carWid,midColor){
        this.width=carWid;
        this.height=carLen;
        let car=new MSprite();
        this.addChild(car);
        this.car=car;
        car.setPos(-carWid/2,-carLen/2);
        //车身
        let body=new MSprite();
        body.drr(carWid,carLen,20,color,{s:1,c:'black'});
        car.addChild(body);
        body.addChild(new MShape().dr(10,carLen,midColor).setPos((carWid-10)/2));
        var mask=new MShape();
        mask.drr(carWid,carLen,20);
        body.mask=mask;
        //前玻璃
        let tw=carWid+10;
        var shape=new MSprite();
		shape.setPos(carWid/2,70);
		shape.dc(40,'#263440');
		car.addChild(shape);
		mask=new MShape();
		mask.dt(tw,tw/2,30);
		mask.x=shape.x;mask.y=shape.y-50;
		shape.mask=mask;
        //后玻璃
        shape=new MSprite();
		shape.setPos(carWid/2,carLen-50);
		shape.dc(40,'#263440');
		car.addChild(shape);
		mask=new MShape();
		mask.dt(tw/2,tw,30);
		mask.x=shape.x;mask.y=shape.y+25;
		shape.mask=mask;
        //两边玻璃
        for(let i=0;i<2;i++){
            shape=new MShape();
            shape.dt(carLen-80,carLen-50,5,'#263440');
            shape.rotation=i==0?90:-90;
            shape.setPos(carWid/2,carLen/2+12);
            shape.x=i==0?8:carWid-8;
            car.addChild(shape);
        }
        //四个车灯
        let ps=[[5,5],[carWid-5,5],[5,carLen-5],[carWid-5,carLen-5]]
        for(let i=0;i<4;i++){
            shape=new MShape();
            shape.dc(5,i<2?'white':'red');
            shape.setPos(ps[i][0],ps[i][1]);
            body.addChild(shape);
        }
        //两个后视镜
        ps=[[0,35],[carWid,35]]
        for(let i=0;i<2;i++){
            shape=new MShape();
            shape.dt(4,6,3,'#263440');
            shape.setPos(ps[i][0],ps[i][1]);
            car.addChild(shape);
        }
        //四个车轮
        ps=[[0,26],[carWid,26],[0,carLen-30],[carWid,carLen-30]]
        this.wheels=[];//前两个车轮
        for(let i=0;i<4;i++){
            shape=new MShape();
            shape.f('black').drawRect(-3,-6,6,12);
            shape.setPos(ps[i][0],ps[i][1]);
            car.addChildAt(shape,0);
            if(i<2)this.wheels.push(shape);
        }
    }
}
class MFruits extends MBasicSprite{
    /**画水果皮*/
	drawFruitSkin(r,c1,c2){
        this.radius=r;
		let node=new MSprite()
		let bg=new MSprite().dc(r,c1);
		let mid=new MSprite().dc(r-5,c2);
        this.addChild(node);
		node.addChild(bg);
		node.addChild(mid);
		return node;
	}
	/**画西瓜*/
	drawWatermelon(r=50,c1='#006600',c2='#FFE1E2',c3='#FF0000') {
		let node=this.drawFruitSkin(r,c1,c2)
		let value=new MSprite().dc(r-10,c3);
		node.addChild(value);
        for (let i = 0; i < 8; i++) {
            let a1=this.angleToRadian(i * 45);
            let r1=r*0.6;
            let [x,y]=[Math.cos(a1)*r1,Math.sin(a1)*r1];
			let v=new MSprite().dc(2,'black').setPos(x,y);
			node.addChild(v);
        }
		return node;
    }
	/**画橘子*/
	drawOrange(r=50,c1='#E1A73C',c2='#FEF6B6',c3='#FFCC00',gap=10) {
		let node=this.drawFruitSkin(r,c1,c2)
		for (let i = 0; i < 8; i++) {
			let [a1,a2]=[(i * 45), (i * 45 + 40)];
            [a1,a2]=[this.angleToRadian(a1),this.angleToRadian(a2)]
            let v=new MSprite();
            v.da(r-gap,a1,a2,c3);
			node.addChild(v);
		}
		return node;
	}
	/**画猕猴桃*/
	drawKiwiFruit(r=50,c1='#006600',c2='#85D927',c3='#006600',c4='#E6FC9A') {
		let node=this.drawFruitSkin(r,c1,c2)
		let value=new MSprite().dc(r*0.4,c4);
		node.addChild(value);
		for (let i = 0; i < 8; i++) {
			let a1=this.angleToRadian(i * 45);
            let r1=r*0.55;
            let [x,y]=[Math.cos(a1)*r1,Math.sin(a1)*r1];
			let v=new MSprite().dc(2,c3).setPos(x,y);
			node.addChild(v);
		}
		return node;
	}
	/**百香果*/
	drawPassionFruit(r=50,c1='#9E3D65',c2='#FFF6D2',c3='#FFC114',c4='#CE9200',znum=30) {
		let [a1,r1]=[0,r*0.8]
		let node=this.drawFruitSkin(r,c1,c2);
		let value=new MSprite().dc(r1,c3);
		node.addChild(value);
		for (let i = 0; i < znum; i++) {
			a1+=72;
			var r2 = r1*(Math.floor(a1/360)+1)*0.12;
			r2=r2>r1?(r1/2+Math.random()*r1/2):r2
			let [x,y]=[Math.cos(a1)*r2,Math.sin(a1)*r2];
			let v=new MSprite().dc(2,c4).setPos(x,y);
			node.addChild(v);
		}
		return node;
	}
	/**画山竹*/
	drawMangosteen(r1=50,r2=12){
		return this.drawOrange(r1,'#5C2F32','#CD544B','#FFFFFF',r2);
	}
	/**火龙果*/
	drawPitaya(r1=50){
		return this.drawPassionFruit(r1,'#D32952','#FFFFFF','#FFFFFF','#000000',50);
	}
}
/**画瓦片*/
class MTile extends MBasicSprite{
    constructor(w=100,h=100){
        super();
        this.width=w;
        this.height=h;
    }
    /**画色*/
    drawColor(c='green',s=null){
        this.removeAllChildren();
        let bg=new MSprite().dr(this.width,this.height,c,s);
        this.addChild(bg);
    }
    /**画墙*/
    drawWall(c1='red',c2='black',s=2){
        this.removeAllChildren();
        let bg=new MSprite().dr(this.width,this.height,c2);
        this.addChild(bg);
        let s1=s/2;
        let [w1,h1,w2]=[(this.width-s)/2,(this.height-s*3)/2,(this.width-s)]
        let node=new MSprite().dr(w1,h1,c1);
        node.setPos(0,s1);
        this.addChild(node);
        node=new MSprite().dr(w1,h1,c1);
        node.setPos(s+w1,s1);
        this.addChild(node);
        node=new MSprite().dr(w2,h1+s,c1);
        node.setPos(s1,s1+w1);
        this.addChild(node);
    }
    /**画田*/
    drawTian(c1='#01AC0E',c2='#00970C',cs=null){
        this.removeAllChildren();
        let [w,h]=[this.width/2,this.height/2];
        let nodes=[];
        let cos=[c1,c2,c2,c1];
        if(cs) cos=cs;
        for(let i=0;i<4;i++){
            let node=new MSprite().dr(w,h,cos[i]);
            nodes.push(node);
            this.addChild(node);
        }
        this.layoutBasic(nodes,2);
    }
    /**画田为45度*/
    drawTian45(c1='#01AC0E',c2='#00970C'){
        this.removeAllChildren();
        let [w,h,mw,mh]=[this.width/2,this.height/2,this.width,this.height];
        let nodes=[];
        let cos=[c1,c2,c1,c2];
        for(let i=0;i<4;i++){
            let node=new MSprite()
            if(i%2==0)node.dt(mw,0,h,cos[i]);
            else      node.dt(mh,0,w,cos[i]);
            node.rotation=i*90;
            if(i%2==0){
                node.x=w;
                if(i==2)node.y=mh;
            }else{
                node.x=mw;node.y=h;
                if(i==3)node.x=0;
            }
            nodes.push(node);
            this.addChild(node);
        }
        //this.layoutBasic(nodes,2)
    }
     /**画体育场像足球场*/
     drawField(c1='#01AC0E',c2='#00970C'){
        this.removeAllChildren();
        let [w,h]=[this.width/2,this.height/2];
        let nodes=[];
        let cos=[c1,c2,c1,c2];
        for(let i=0;i<4;i++){
            let node=new MSprite().dr(w,h,cos[i]);
            nodes.push(node);
            this.addChild(node);
        }
        this.layoutBasic(nodes,2)
    }
    /**画马路*/
    drawLoad(c1='#999999',c2='#ffffff'){
        this.removeAllChildren();
        let node=new MSprite().dr(this.width,this.height,c1);
        this.addChild(node);
        let [w,h]=[this.width/10,this.height/4];
        let nodes=[];
        for(let i=0;i<2;i++){
            let node=new MSprite().dr(w,h,c2);
            nodes.push(node);
            this.addChild(node);
        }
        this.layoutBasic(nodes,1,h,h,(this.width-w)/2,h/2)
    }
}
class QuestAnswer extends MBasicSprite{
    constructor(wid=200,hei=250){
        super();
        let color='#EA8133';
        var bg=new MSprite();
        this.addChild(bg);
        bg.drr(wid,hei,8,color);
        let txtTitle=new MLabel({label:'1+1=',c:'black'});
        txtTitle.setPos(wid/2,hei*0.1);
        bg.addChild(txtTitle);
        this.txtTitle=txtTitle;
        let txtAnswer=new MLabel({label:'',c:'black'});
        txtAnswer.setPos(wid/2,hei*0.3);
        bg.addChild(txtAnswer);
        this.txtAnswer=txtAnswer;
        let btns=[];
        let r=wid/14;
        for(let i=0;i<10;i++){
            let btn=new MCircleButton({label:i,radius:r});
            bg.addChild(btn);
            btns.push(btn);
			btn.addEvent(mConst.CLICK,this.onInput.bind(this,i));
        }
        let xnum=5;
        let gap=wid/(xnum+4)-r;
        this.displayRank(btns,xnum,gap,gap,gap*1.5,hei*0.4);
        
        let names=['确定','取消','清除'];
        let btn2s=[];
        for(let i=0;i<names.length;i++){
            let btn=new MButton({label:names[i],width:r*4,height:r*2});
            bg.addChild(btn);
            btn2s.push(btn);
            btn.addEvent(mConst.CLICK,this.onClick.bind(this,i));
        }
        xnum=3;
        gap=wid/(xnum+2)-r*2;
        this.displayRank(btn2s,xnum,gap,gap,gap/4,hei*0.8);
    }
    onInput(i){
        this.txtAnswer.value+=i;
    }
    onClick(i){
        switch(i){
            case 0://确定
                this.emitEvent(mConst.COMPLETE);
                this.removeFromParent();
                break;
            case 1://取消
                this.removeFromParent();
                break;
            case 2://清除
                this.txtAnswer.value="";
                break;
        }
    }
    getRandomWeiShu(num){
		var max=Math.pow(10,num)-1;
		var min=Math.pow(10,num-1);
		return Math.floor(Math.random()*(max-min+1)+min);
	}
    /**设置乘法题目默认是2位乘以1位 */
    setMul(num1=1,num2=2){
        var max=this.getRandomWeiShu(num2);
        var min=this.getRandomWeiShu(num1);
        this.txtTitle.value=`${max}x${min}=`;
        this.answer=max*min;
        this.txtAnswer.value="";
    }
    isRight(){
        console.log(this.answer,this.txtAnswer.value);
        return this.answer==this.txtAnswer.value;
    }
}
class MEmoji extends MBasicSprite{
    //https://getemoji.com/
    //https://emojixd.com/list#h-food-drink
    //https://www.emojiall.com/zh-hans
    drawEmoji(emoji,scale=2){
        this.removeAllChildren();
        this.label=new MLabel({label:emoji});
        this.setScale(scale);
        this.addChild(this.label);
        return this.label;
    }
    addChildEmoji(txts,type,scale=2){
        if(type<0||type>txts.length-1)type=Math.floor(Math.random()*txts.length);
        let emoji=txts[type];
        let node=this.drawEmoji(emoji,scale);
        return node;
    }
    drawFruits(type=0,scale=2){
        let txts=['🍇','🍈','🍉','🍊','🍋','🍌','🍍','🥭','🍎','🍏','🍐','🍑','🍒','🍓','🥝','🍅','🥥','🥑','🍆','🥔','🥕','🌽','🌶️','🥒','🥬','🥦','🧄','🧅','🥜']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }    
    drawCar(type=0,scale=2){
        let txts=['🚔','🚍','🚘','🚖','🚋','🚌','🚍','🚎','🚐','🚑','🚒','🚓','🚔','🚕','🚖','🚗','🚘','🚙','🚚','🚛','🚜','🏎️','🚴‍♀️','🚴','🏍️','🛵','🦽','🦼','🛺','🚲','🛴']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawAnimal(type=0,scale=2){
        let txts=['🐶','🐱','🐭','🐹','🐰','🦊','🐻','🐼','🐨','🐯','🦁','🐮','🐷','🐸','🐵','🐺','🐗','🦝']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawTreeFlower(type=0,scale=2){
        let txts=['🎄','🌲','🌳','🌴','🌱','🌿','☘️','🍀','🎍','🎋','🍃','🍂','🍁','🍄','🐚','🌾','💐','🌷','🌹','🥀','🌺','🌸','🌼','🌻']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawFish(type=0,scale=2){
        let txts=['🐡','🐠','🐟','🐬','🐳','🐋','🦈','🐙','🦑','🦐','🦞','🦀']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawInsect(type=0,scale=2){
        let txts=['🐝','🐛','🦋','🐌','🐞','🐜','🦟','🦗','🦂']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawBall(type=0,scale=2){
        let txts=['⚽️','🏀','🏈','⚾️','🥎','🏐','🏉','🎱','🪀','🏓','🎾','🌕','🌖','🌗','🌘','🌑','🌒','🌓','🌔','🌙','🌎','🌍','🌏','🪐']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawFace(type=0,scale=2){
        let txts=['😀','😃','😄','😁','😆','😅','😂','🤣','😊','😇','🙂','🙃','😉','😌','😍','🥰','😘','😗','😙','😚','😋','😛','😝','😜','🤪','🤨','🧐','🤓','😎','🤩','🥳','😏','😒','😞','😔','😟','😕','🙁','☹️','😣','😖','😫','😩','🥺','😢','😭','😤','😠','😡','🤬','🤯','😳','🥵','🥶','😱','😨','😰','😥','😓','🤗','🤔','🤭','🤫','🤥','😶','😐','😑','😬','🙄','😯','😦','😧','😮','😲','🥱','😴','🤤','😪','😵','🤐','🥴','🤢','🤮','🤧','😷','🤒','🤕','🤑']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawLoveStar(type=0,scale=2){
        let txts=['❤️','🧡','💛','💚','💙','💜','🖤','🤍','🤎','💔','💕','💓','💗','💖','💘','💝','💟']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawControl(type=0,scale=2){
        let txts=['▶️','⏸','⏯','⏹','⏺','⏭','⏮','⏩','⏪','⏫','⏬','◀️','🔼','🔽','⏏️','➡️','⬅️','⬆️','⬇️','↪️','↩️','⤴️','⤵️','🔀','🔁','🔂','🔄','🔃']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawCard(type=0,scale=2){
        let txts=['♠️','♣️','♥️','♦️','🃏','🎴','🀄️']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawSex(type=0,scale=2){
        let txts=['♀️','♂️']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawRightWrong(type=0,scale=2){
        let txts=['❌','✔️','💯']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawLock(type=0,scale=2){
        let txts=['🔒','🔓','🔑','🔏','🔐','🗝']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawOther(type=0,scale=2){
        let txts=['⚙️','💡','🩸','⏰','🥮','🛸','🔈','🔇','🏵','🗑']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawPenBook(type=0,scale=2){
        let txts=['✏️','📔','📐','📏','🖊','🖋','✒️','🖌','🖍','📝','📒','📕','📗','📘','📙','📓','📚','📖']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawClock(type=0,scale=2){//1点到12点
        let txts=['🕐','🕑','🕒','🕓','🕔','🕕','🕖','🕗','🕘','🕙','🕚','🕛']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawRank(type=0,scale=2){
        let txts=['🥇','🥈','🥉','🏆','🏅','🎖️']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawMoney(type=0,scale=2){
        let txts=['💎','💵','💸','💰','📀']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }
    drawDice(type=0,scale=2){
        let txts=['⚀','⚁','⚂','⚃','⚄','⚅','🎲']
        let node=this.addChildEmoji(txts,type,scale)
        return node;
    }

    setScale(s){
        this.label.fontSize=20*s;
        this.width=this.height=22*s;
    }
    setSize(s){
        this.label.fontSize=s;
        this.width=this.height=s;
    }
    setAnchor(s=0){
        if(s==0){//左上
            this.label.x=this.width/2;
            this.label.y=this.height/2;
        }
    }
    set color(c){
        this.label.color=c;
    }
}